Caches are commonly used in computer system. A cache is a collection of data duplicating original values stored elsewhere or computed earlier, where the original data is expensive to fetch (due to slow access time) or to compute, relative to the cost of reading the cache. In other words, a cache is a temporary storage area where frequently accessed data can be stored for rapid access. Once the data is stored in the cache, future use can be made by accessing the cached copy rather than re-fetching or recomputing the original data, so that the average access time is lower.
Caches have proven to be extremely effective in many areas of computing because access patterns in typical computer applications have locality of reference (temporal and spatial locality). Temporal locality refers to data that are accessed close together in time. Spatial locality refers to data that might or might not be located physically close to each other.
Given how inexpensive computer memory is, it is desirable to use memory as a replacement to traditional disk or tape based storage as it is much, much faster to access. The main drawback with this approach is that a single computer has limits to how much memory it can have, as well as the fact that memory is transient and contents can be lost if a computer crashes. However, arranging a large number of inexpensive computers in a grid can provide a large amount of aggregate memory, as well as crash resilience and fault tolerance when used with a clustering library like JBoss Cache.